<% display_tag_name = @tag.pretty_name.presence || @tag.name.capitalize %>
<% title_with_timeframe(
     page_title: display_tag_name + (@page.present? && @page > 1 ? t("views.stories.meta.page", page: @page) : ""),
     timeframe: params[:timeframe],
     content_for: true,
   ) %>

<link rel="canonical" href="<%= tag_url(@tag, @page) %>" />
<meta name="description" content="<%= t("views.stories.meta.description_tagged", tag: @tag.name, name: community_name) %>">
<%= meta_keywords_tag(@tag.name) %>

<meta property="og:type" content="website" />
<meta property="og:url" content="<%= tag_url(@tag, @page) %>" />
<meta property="og:title" content="<%= title_with_timeframe(page_title: display_tag_name, timeframe: params[:timeframe]) %>" />
<meta property="og:description" content="<%= t("views.stories.meta.description_tagged", tag: display_tag_name, name: community_name) %>" />
<meta property="og:site_name" content="<%= community_name %>" />

<meta name="twitter:site" content="@<%= Settings::General.social_media_handles["twitter"] %>">
<meta name="twitter:creator" content="@<%= display_tag_name %>">
<meta name="twitter:title" content="<%= title_with_timeframe(page_title: display_tag_name, timeframe: params[:timeframe]) %>">
<meta name="twitter:description" content="<%= t("views.stories.meta.description_tagged", tag: display_tag_name, name: community_name) %>">

<% if @tag %>
  <meta name="twitter:card" content="summary_large_image">
  <meta property="og:image" content="<%= Settings::General.main_social_image %>">
  <meta name="twitter:image:src" content="<%= Settings::General.main_social_image %>">
<% else %>
  <meta property="og:image" content="<%= Settings::General.main_social_image %>">
  <meta name="twitter:image:src" content="<%= Settings::General.main_social_image %>">
  <meta name="twitter:card" content="summary_large_image">
<% end %>
